import cTitle from "components/title";
import { Toast } from 'vant';
import {scrollMixin} from '../../../utils/mixin';
export default {
  mixins: [scrollMixin], //加载更多
  data() {
    return {
      tabsList: [
        {
          title: 'A区'
        },
        {
          title: 'B区'
        }
      ],
      memberListA: [],//A区业绩列表
      memberListB: [],//B区业绩列表
      currentTabs: 0,
      totalPeople: 0,//总人数
      aYeji: 0,//A区业绩
      bYeji: 0,//B区业绩
    };
  },
  activated() {
    let that = this;
    // this.init();
    this.getData();
    
  },
  mounted() {
  },
  methods: {
    changeTabs(item, index) {
      console.log(item,index,'changeTabs')
      this.currentTabs = index
    },
    init(){
      const that = this;
      let _url =
        this.tag == 1
          ? "plugin.redpack.frontend.activity.getShareLog"
          : "plugin.redpack.frontend.activity.getChallengeLog";
      $http.get(_url, { aid: that.aid }, "").then(
        function(response) {
          if (response.result === 1) {
            that.isLoadMore = true;
            that.total_page = response.data.log.last_page;
            if (!that.total_page) {
              that.total_page = 0;
            }
            that.extractWord = response.data;
            that.log = response.data.log.data;
            that.info = response.data.member;
          } else {
            Toast(response.msg);
          }
        },
        function(response) {
          // error callback
        }
      );
    },
    getData() {
      const that = this;
      let _url = "Kanglier.team";
      let uid = localStorage.getItem("uid")
      $http.get(_url, { uid: uid }, "").then(
        function(response) {
          console.log(response,'response  Kanglier.team')
          if (response.result === 1) {
            let data = response.data;
            that.memberListA = data.a_list;
            that.memberListB = data.b_list;
            that.totalPeople = data.a_rensu + data.b_rensu;
            that.aYeji = data.a_yeji;
            that.bYeji = data.b_yeji;
            console.log(that.memberListA,that.memberListB,'nnnnnnnnnnnnnnnn')
          } else {
            Toast(response.msg);
          }
        },
        function(response) {
          // error callback
        }
      );
    },
   
  },
  components: { cTitle }
};
